/*
** ############################################################################
**     Project   : osdee - Operative Systems Design for Embedded Envrionments
**     File      : OS_Cfg.h
**     Revision  ; 1.0
**     Abstract  :
**         Scheduler Configuration Interface.
**         Definition of the Binary Progressive Scheduler Configuration elements
**
**     Copyright : 2014 Fernando Rodriguez - Victor Huidobro, 
**                 Open source with out any responsability.
**     
**     mail      : frr@gmail.com, vhuidobrog@gmail.com
** ############################################################################
*/

#ifndef _OS_CFG_H_
#define _OS_CFG_H_

#include "OS_Types.h"
#include "Gpt_Cfg.h"
#include "OS_Task.h"

/*
** ===================================================================
**     Basic definitios for current
**          Binary Progressive Scheduler. 
** ===================================================================
*/
#define    OS_CONFIGURED_TASKS    7  /* Number of configured TASKS */
#define    OS_MAX_ACTIVATIONS     2  /* Maximun number of activations per task */


/*
** ===================================================================
**     Type        :  tsOS_Task_Cfg
**
**     Description :
**         Specific Task Configuration.
**         - tId       : Task Id.
**         - tMask     : Assigned Task Mask.
**         - tOffset   : Assigned Task Offset.
**         - tCallback : Task Call back.
**         - tState   : Task status.
** ===================================================================
*/
typedef struct 
{
  teOS_Task_Id tId;
  UINT8 u8Mask;
  UINT8 u8Offset;
  UINT8 u8Priority;
  tCallbackFunction tCallback;
  UINT16  u16StackSize;
  UINT16  u16RelDeadline;
} tsOS_Task_Cfg;
/*
** ===================================================================
**     Type        :  tsStack_Block
**
**     Description :
**         
**         
**        
** ===================================================================
*/
typedef struct 
{
  UINT8     DUMMY;
  UINT8     PAGE;
  UINT16    CCR;  
  UINT16    D;  
  UINT16    X;
  UINT16    Y;  
  UINT16    R;
  
}tsOS_Stack_Block;
/*
** ===================================================================
**     Type        :  tsOS_Cfg
**
**     Description :
**         Contains the general Scheduler Configuration.
**         - tOsTick_Cfg : OS TICK configuration through a GPT Channel.
**         - atTasks     : Array of tasks to be scheduled.
** ===================================================================
*/
typedef struct 
{
  tsOS_Task_Cfg const*    ptTask;  
  teOS_Task_State         tState;  /* Should be state */
  tsOS_Stack_Block*       ptStack;
  UINT8 u8Priority;
  UINT8 u8Activations;
}tsTask_Ctrl_Block;




/*
** ===================================================================
**     Type        :  tsOS_Cfg
**
**     Description :
**         Contains the general Scheduler Configuration.
**         - tOsTick_Cfg : OS TICK configuration through a GPT Channel.
**         - atTasks     : Array of tasks to be scheduled.
** ===================================================================
*/
typedef struct 
{
  const tsOS_Task_Cfg*  ptsDescriptor;
  UINT8           u8Task_Number;  
}tsOS_Des_Cfg;

/*
** ===================================================================
**     Type        :  ser_tOS_configuration
**
**     Description :
**         Stores the Scheduler Configuration.
** ===================================================================
*/
extern const tsOS_Des_Cfg TaskConfig[];


#endif /*_OS_CFG_H_*/